Uploading and Downloading Files with FTP

These notes will help you upload and download files via FTP Ftp is not a single program, but rather a convention on a way to send and receive programs. There are many ftp programs, but they all work in a similar way. The original FTP programs were text based programs. You would use them to log into a server and then "put" files to send (upload) them to the server, and "get" files to receive (download). Some FTP programs are text based. Others, such as "Core FTP", have a windows based interface that does some of the typing for you. Some web editing programs such as "Dreamweaver" have ftp built in, and allow you to upload your files semiautomatically when you make changes. Web Browsers such as "Internet Epxlorer", "Safari" and "Firefox" also have FTP built in, which means you can use them to download files.

FTP and your Web Browser

Web browsers usually have FTP built in. Every time you look at something in your web browser, it's doing ftp, or something very similar, because it is downloading files. When you right click on a picture, and save, this is an FTP type transaction. You don't really need to know the details of FTP to make this work, but inside, this is what is happening.

You can't really reverse the process however. Many sites allow you to download files without a password. That's how websites work, right? But very few sites will let you upload without permission or passwords. So, you can't upload files directly with Explorer or Safari or Firefox.

This is where real FTP programs come in.

Before we get started, we should discuss the vocabulary.

Definitions

FTP"File transfer protocol", a way to send or receive files.
Server The computer you will send or recieve files from. Any computer can be a server. A server is simply a computuer that is on the internet which has a website or other public resources available. Most servers are ordinary computers using Windows or Linux.
Client Your computer. This is the computer you are sitting in front of when you upload or download files.
File The files you want to send or recieve.
Upload Send files to the server. Let's suppose you have built a website on your home computer and you want to put it on the server so other people can see it. This process is called "uploading".
Put The command to send files to the server. This is one of the commands in FTP.
Download Get files from the server. Let's suppose you see a graphic that you want to use on a free images site. You want to get a copy of it so you can incorporate it into your site. This means you need to "download" the file. Or let's say you have a website on the server, and you want to get a copy so you can work on it at home. You need to download the site. Later, after you have made your changes, you can upload them again.
Get The command to get files from the server. This is another FTP program command.

Command Line FTP

The original FTP was a text based program. There are versions for WIndows, Unix, and Macintosh that are built into the system. This is great because it means you don't have to install any software to get this to work. The original version is Unix, but the Mac and Windows built in versions use pretty much the same commands.

We will discuss how to start the command line FTP in each of these systems, and then we will discuss the commands.

You may also want to read some of the notes we have on files and folders, because locating files and knowing where you are on the hard drive is very important when you are trying to upload and download files.

Using FTP in Windows

You can use FTP from the command line from a DOS window.

To open DOS, go to START and select RUN. In the little box type "cmd". This will start DOS.

DOS is basically a black window that allows you to type commands. You can now run Windows FTP the same as UNIX FTP (see below).

The command to start DOS FTP is "ftp www.brandx.net". This will connect you to www.brandx.net, but you can subsitute a different server name if you want to connect to somewhere else. After you type the command, the server will ask you for a username and password. Use the ones you were given in class.

To exit the program, type "quit" or "control-c".

The rest of DOS FTP is the same as the Unix program.

Using FTP in Macintosh

From a mac terminal window you an run FTP. Terminal is found in the applications folder under Utilities.

The terminal is a black window where you can type commands directly into the Mac system.

If you want to connect to the Brand X Web server, use this command from the terminal

      ftp www.brandx.net

The server will ask for a username and password.

From the terminal window the commands will be the same as UNIX FTP.

Unix FTP Commands

get myfile Download (receive) this file. Subsitute the name of the file you want for "myfile". Note that if you are in the wrong folder or if you spell the name of the file wrong, it won't work.
put myfile Upload (send) this file. Subsitute the name of the file you want for "myfile". Note that if you are in the wrong folder or if you spell the name of the file wrong, it won't work.
ls List the files on the server in the current directory. This gives you the names of the files, but not size and ownership. Listing the files can be very helpful if you are having trouble spelling the names of things, or if you aren't sure where you are on the server or what you are looking at.
ls -al List files on the server, inthe current folder, with details. This includes ownership, size, date, and permissions for each file.
delete filename Delete this file from the server
rename filename Rename the file on the server
mkdir dirname Create a directory called dirname on the server
cd dirname Move to this directory on the server
pwd Show the current location on the server, with complete path. If you are confused about what folder you are in on the server, this will help. Note that this does not tell you where you are on your home computer, we are talking about the server.
cd ~ Move to my home directory on the server. If you are confused about where you are this can be very helpful because it puts you back where you were when you first logged in.
cd .. Move up one layer in the directory tree
lcd dirname Move to this directory on your computer. This is different than changing folders on the server. Usually it is easier to start in the right directory before you open the ftp program, but you do have some ability to navigate on your home computer even when you are in FTP.
help Get help. This will list the options for FTP.
quit Quit the program and return to Dos/Unix/Mac system.

Sample Session

We will start from the beginning.

First open DOS. From the start menu, select "run", put "cmd" in the run box, and hit enter. This will open a black DOS window where we can type our commands.

Now I will show a transcript of my session.

Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

C:\Users\jimp>ftp www.brandx.net
Connected to www.brandx.net.
220 Welcome to the server WWW.BRANDX.NET
User (www.brandx.net:(none)): lacc-student
331 Please specify the password.
Password:
230 Login successful.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
ADBEPHSPCS3_WWE.exe
Aida.html
AniDanielyan2.html
Arman
.
.
.
jacklinlarian.html~
jim.txt
jimpickrell
jimpickrell.html
jimpickrell.html~
jimpickrell2.html
joan.html
joanbryant,html
.
.
etc. etc. etc..

226 Directory send OK.
ftp: 2091 bytes received in 0.19Seconds 10.83Kbytes/sec.

Let's download a file

ftp> get telephone-jim.html
200 PORT command successful. Consider using PASV.
150 Opening BINARY mode data connection for telephone-jim.html (588 bytes).
226 File send OK.
ftp: 588 bytes received in 0.00Seconds 588.00Kbytes/sec.

Note the response here from ftp that tells us the download worked. Now let's send this same file back to the server.

ftp> put telephone-jim.html
200 PORT command successful. Consider using PASV.
553 Could not create file.

What went wrong? This file already exists. Let's rename it. Then we can upload.

 

ftp> rename telephone-jim.html telephone-jimpickrell.html
350 Ready for RNTO.
250 Rename successful.
ftp> put telephone-jim.html
200 PORT command successful. Consider using PASV.
150 Ok to send data.
226 File receive OK.
ftp: 588 bytes sent in 0.05Seconds 12.00Kbytes/sec.

Let's list out the files and see what we have. In order to keep it quick let's only list out files that start with jim.

 

ftp> ls jim*
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
jim.txt
jimpickrell
jimpickrell.html
jimpickrell.html~
jimpickrell2.html
226 Directory send OK.
ftp: 78 bytes received in 0.01Seconds 6.50Kbytes/sec.
ftp> quit
221 Goodbye.

C:\Users\jimp>

Done so we have logged out.

Windows FTP

If you want to use a drag and drop version of FTP try "Core FTP" which can be downloaded from CNET (download.com). Download.com is generally a good place to get free software; it is less likely to have viruses than other sources.

Another new choice that is very popular is "Filezilla" which can be found at http://download.cnet.com/FileZilla/3000-2160_4-10308966.html

Documentation for Filezilla is found at http://wiki.filezilla-project.org/Documentation.